#ifndef __BSW_LPUART_H__
#define __BSW_LPUART_H__






#include "lpuart_hw_access.h"





typedef struct
{
	LPUART_Type*									base;									/* UART硬件模块选择:  LPUART0                       			*/
	clock_names_t									clockName;						/* UART的PCC时钟选择: LPUART0_CLK       									*/
	uint32_t											clockSource;					/* PCC时钟选择:   eg:	6  时钟设置为40M          					*/

	uint32_t											OSRatio;							/* 采样率设置			eg:	15 采样率15+1=16										*/
	uint32_t											BaudRate;							/* 波特率设置			eg:	22 波特率115200 40M/115200/16 = 21.7*/
	lpuart_bit_count_per_char_t		DataBit;							/* 数据位设置  		eg:	LPUART_8_BITS_PER_CHAR	8个数据位		*/
	lpuart_stop_bit_count_t				StopBit;							/* 停止位设置  		eg:	LPUART_ONE_STOP_BIT 		1个停止位		*/
	lpuart_parity_mode_t					PrtMode;							/* 奇偶校验设置		eg：LPUART_PARITY_DISABLED 	无奇偶校验	*/
	
	bool													RxDmaCmd;							/* RDMAE, RDMAE=0: DMA requests disabled 									*/
	bool													TxDmaCmd;							/* TDMAE, TDMAE=0: DMA requests disabled 									*/
	uint32_t 									 		RxWater;				      /* 设置RxFIFO     eg: 0 接收到 > 0个字节的数据触发        */
	uint32_t 									 		TxWater;				      /* 设置TxFIFO     eg: 1 接收到 < 1个字节的数据触发        */
	bool													BothEgSCmd;						/* 接收采集边沿  	eg:	false	只采集上升沿 									*/
	
	bool													RxCmd;								/* 接收使能设置 	eg:	true		使能接收										*/	
	bool													TxCmd;								/* 发送使能设置 	eg:	true		使能发送										*/
}Bsw_Lpuart_Cfg;


void BSW_LPUART_INIT(Bsw_Lpuart_Cfg Lpuart_Cfg);

u8 BSW_LPUART_Receive_char(LPUART_Type* base);

void BSW_LPUART_SData(LPUART_Type* base,u8 send) ;
void BSW_LPUART_Send_Char(LPUART_Type* base,u8* DataArr);

#endif
